<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idCardNumber">
        <el-input
          v-model="queryParams.idCardNumber"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出生日期" prop="birthDate">
        <el-date-picker clearable
          v-model="queryParams.birthDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择出生日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="民族" prop="ethnicity">
        <el-input
          v-model="queryParams.ethnicity"
          placeholder="请输入民族"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省" prop="province">
        <el-input
          v-model="queryParams.province"
          placeholder="请输入省"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="市" prop="city">
        <el-input
          v-model="queryParams.city"
          placeholder="请输入市"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="区/县" prop="district">
        <el-input
          v-model="queryParams.district"
          placeholder="请输入区/县"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="详细地址" prop="detailAddress">
        <el-input
          v-model="queryParams.detailAddress"
          placeholder="请输入详细地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系电话" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入联系电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="家属1姓名" prop="familyName1">
        <el-input
          v-model="queryParams.familyName1"
          placeholder="请输入家属1姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="家属1电话" prop="familyPhone1">
        <el-input
          v-model="queryParams.familyPhone1"
          placeholder="请输入家属1电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="家属2姓名" prop="familyName2">
        <el-input
          v-model="queryParams.familyName2"
          placeholder="请输入家属2姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="家属2电话" prop="familyPhone2">
        <el-input
          v-model="queryParams.familyPhone2"
          placeholder="请输入家属2电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毕业所在省" prop="graduateProvince">
        <el-input
          v-model="queryParams.graduateProvince"
          placeholder="请输入毕业所在省"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毕业所在市" prop="graduateCity">
        <el-input
          v-model="queryParams.graduateCity"
          placeholder="请输入毕业所在市"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毕业所在区/县" prop="graduateDistrict">
        <el-input
          v-model="queryParams.graduateDistrict"
          placeholder="请输入毕业所在区/县"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毕业学校" prop="graduateSchool">
        <el-input
          v-model="queryParams.graduateSchool"
          placeholder="请输入毕业学校"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="准考证号" prop="examNumber">
        <el-input
          v-model="queryParams.examNumber"
          placeholder="请输入准考证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报读学校" prop="targetSchool">
        <el-input
          v-model="queryParams.targetSchool"
          placeholder="请输入报读学校"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业方向" prop="majorDirection">
        <el-input
          v-model="queryParams.majorDirection"
          placeholder="请输入专业方向"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报读专业" prop="targetMajor">
        <el-input
          v-model="queryParams.targetMajor"
          placeholder="请输入报读专业"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createdAt">
        <el-date-picker clearable
          v-model="queryParams.createdAt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="更新时间" prop="updatedAt">
        <el-date-picker clearable
          v-model="queryParams.updatedAt"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['application:application:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['application:application:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['application:application:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['application:application:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="applicationList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="身份证号" align="center" prop="idCardNumber" />
      <el-table-column label="性别" align="center" prop="gender" />
      <el-table-column label="出生日期" align="center" prop="birthDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.birthDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="民族" align="center" prop="ethnicity" />
      <el-table-column label="身份证住址" align="center" prop="idCardAddress" />
      <el-table-column label="身份证反面照片路径" align="center" prop="idCardBackImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.idCardBackImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="身份证正面照片路径" align="center" prop="idCardFrontImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.idCardFrontImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="监护人身份证正面照片路径" align="center" prop="guardianIdCardFrontImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.guardianIdCardFrontImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="监护人身份证反面照片路径" align="center" prop="guardianIdCardBackImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.guardianIdCardBackImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="户口本首页照片路径" align="center" prop="householdCoverImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.householdCoverImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="户口本信息页照片路径" align="center" prop="householdInfoImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.householdInfoImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="户主户口本首页照片路径" align="center" prop="householdOwnerCoverImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.householdOwnerCoverImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="户主户口本信息页照片路径" align="center" prop="householdOwnerInfoImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.householdOwnerInfoImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="毕业证照片路径" align="center" prop="graduationCertificateImage" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.graduationCertificateImage" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="省" align="center" prop="province" />
      <el-table-column label="市" align="center" prop="city" />
      <el-table-column label="区/县" align="center" prop="district" />
      <el-table-column label="详细地址" align="center" prop="detailAddress" />
      <el-table-column label="联系电话" align="center" prop="phone" />
      <el-table-column label="家属1姓名" align="center" prop="familyName1" />
      <el-table-column label="家属1电话" align="center" prop="familyPhone1" />
      <el-table-column label="家属2姓名" align="center" prop="familyName2" />
      <el-table-column label="家属2电话" align="center" prop="familyPhone2" />
      <el-table-column label="毕业所在省" align="center" prop="graduateProvince" />
      <el-table-column label="毕业所在市" align="center" prop="graduateCity" />
      <el-table-column label="毕业所在区/县" align="center" prop="graduateDistrict" />
      <el-table-column label="毕业学校" align="center" prop="graduateSchool" />
      <el-table-column label="毕业情况" align="center" prop="graduateStatus" />
      <el-table-column label="准考证号" align="center" prop="examNumber" />
      <el-table-column label="报读学校" align="center" prop="targetSchool" />
      <el-table-column label="专业方向" align="center" prop="majorDirection" />
      <el-table-column label="报读专业" align="center" prop="targetMajor" />
      <el-table-column label="注册进度状态" align="center" prop="registrationStatus" />
      <el-table-column label="处理状态" align="center" prop="status" />
      <el-table-column label="备注信息" align="center" prop="remark" />
      <el-table-column label="创建时间" align="center" prop="createdAt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新时间" align="center" prop="updatedAt" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['application:application:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['application:application:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改报名信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="身份证号" prop="idCardNumber">
          <el-input v-model="form.idCardNumber" placeholder="请输入身份证号" />
        </el-form-item>
        <el-form-item label="出生日期" prop="birthDate">
          <el-date-picker clearable
            v-model="form.birthDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择出生日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="民族" prop="ethnicity">
          <el-input v-model="form.ethnicity" placeholder="请输入民族" />
        </el-form-item>
        <el-form-item label="身份证住址" prop="idCardAddress">
          <el-input v-model="form.idCardAddress" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="身份证反面照片路径" prop="idCardBackImage">
          <image-upload v-model="form.idCardBackImage"/>
        </el-form-item>
        <el-form-item label="身份证正面照片路径" prop="idCardFrontImage">
          <image-upload v-model="form.idCardFrontImage"/>
        </el-form-item>
        <el-form-item label="监护人身份证正面照片路径" prop="guardianIdCardFrontImage">
          <image-upload v-model="form.guardianIdCardFrontImage"/>
        </el-form-item>
        <el-form-item label="监护人身份证反面照片路径" prop="guardianIdCardBackImage">
          <image-upload v-model="form.guardianIdCardBackImage"/>
        </el-form-item>
        <el-form-item label="户口本首页照片路径" prop="householdCoverImage">
          <image-upload v-model="form.householdCoverImage"/>
        </el-form-item>
        <el-form-item label="户口本信息页照片路径" prop="householdInfoImage">
          <image-upload v-model="form.householdInfoImage"/>
        </el-form-item>
        <el-form-item label="户主户口本首页照片路径" prop="householdOwnerCoverImage">
          <image-upload v-model="form.householdOwnerCoverImage"/>
        </el-form-item>
        <el-form-item label="户主户口本信息页照片路径" prop="householdOwnerInfoImage">
          <image-upload v-model="form.householdOwnerInfoImage"/>
        </el-form-item>
        <el-form-item label="毕业证照片路径" prop="graduationCertificateImage">
          <image-upload v-model="form.graduationCertificateImage"/>
        </el-form-item>
        <el-form-item label="省" prop="province">
          <el-input v-model="form.province" placeholder="请输入省" />
        </el-form-item>
        <el-form-item label="市" prop="city">
          <el-input v-model="form.city" placeholder="请输入市" />
        </el-form-item>
        <el-form-item label="区/县" prop="district">
          <el-input v-model="form.district" placeholder="请输入区/县" />
        </el-form-item>
        <el-form-item label="详细地址" prop="detailAddress">
          <el-input v-model="form.detailAddress" placeholder="请输入详细地址" />
        </el-form-item>
        <el-form-item label="联系电话" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入联系电话" />
        </el-form-item>
        <el-form-item label="家属1姓名" prop="familyName1">
          <el-input v-model="form.familyName1" placeholder="请输入家属1姓名" />
        </el-form-item>
        <el-form-item label="家属1电话" prop="familyPhone1">
          <el-input v-model="form.familyPhone1" placeholder="请输入家属1电话" />
        </el-form-item>
        <el-form-item label="家属2姓名" prop="familyName2">
          <el-input v-model="form.familyName2" placeholder="请输入家属2姓名" />
        </el-form-item>
        <el-form-item label="家属2电话" prop="familyPhone2">
          <el-input v-model="form.familyPhone2" placeholder="请输入家属2电话" />
        </el-form-item>
        <el-form-item label="毕业所在省" prop="graduateProvince">
          <el-input v-model="form.graduateProvince" placeholder="请输入毕业所在省" />
        </el-form-item>
        <el-form-item label="毕业所在市" prop="graduateCity">
          <el-input v-model="form.graduateCity" placeholder="请输入毕业所在市" />
        </el-form-item>
        <el-form-item label="毕业所在区/县" prop="graduateDistrict">
          <el-input v-model="form.graduateDistrict" placeholder="请输入毕业所在区/县" />
        </el-form-item>
        <el-form-item label="毕业学校" prop="graduateSchool">
          <el-input v-model="form.graduateSchool" placeholder="请输入毕业学校" />
        </el-form-item>
        <el-form-item label="准考证号" prop="examNumber">
          <el-input v-model="form.examNumber" placeholder="请输入准考证号" />
        </el-form-item>
        <el-form-item label="报读学校" prop="targetSchool">
          <el-input v-model="form.targetSchool" placeholder="请输入报读学校" />
        </el-form-item>
        <el-form-item label="专业方向" prop="majorDirection">
          <el-input v-model="form.majorDirection" placeholder="请输入专业方向" />
        </el-form-item>
        <el-form-item label="报读专业" prop="targetMajor">
          <el-input v-model="form.targetMajor" placeholder="请输入报读专业" />
        </el-form-item>
        <el-form-item label="备注信息" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="创建时间" prop="createdAt">
          <el-date-picker clearable
            v-model="form.createdAt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="更新时间" prop="updatedAt">
          <el-date-picker clearable
            v-model="form.updatedAt"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择更新时间">
          </el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listApplication, getApplication, delApplication, addApplication, updateApplication } from "@/api/application/application";

export default {
  name: "Application",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报名信息表格数据
      applicationList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        idCardNumber: null,
        gender: null,
        birthDate: null,
        ethnicity: null,
        idCardAddress: null,
        idCardBackImage: null,
        idCardFrontImage: null,
        guardianIdCardFrontImage: null,
        guardianIdCardBackImage: null,
        householdCoverImage: null,
        householdInfoImage: null,
        householdOwnerCoverImage: null,
        householdOwnerInfoImage: null,
        graduationCertificateImage: null,
        province: null,
        city: null,
        district: null,
        detailAddress: null,
        phone: null,
        familyName1: null,
        familyPhone1: null,
        familyName2: null,
        familyPhone2: null,
        graduateProvince: null,
        graduateCity: null,
        graduateDistrict: null,
        graduateSchool: null,
        graduateStatus: null,
        examNumber: null,
        targetSchool: null,
        majorDirection: null,
        targetMajor: null,
        registrationStatus: null,
        status: null,
        createdAt: null,
        updatedAt: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        idCardNumber: [
          { required: true, message: "身份证号不能为空", trigger: "blur" }
        ],
        gender: [
          { required: true, message: "性别不能为空", trigger: "blur" }
        ],
        birthDate: [
          { required: true, message: "出生日期不能为空", trigger: "blur" }
        ],
        ethnicity: [
          { required: true, message: "民族不能为空", trigger: "blur" }
        ],
        idCardAddress: [
          { required: true, message: "身份证住址不能为空", trigger: "blur" }
        ],
        province: [
          { required: true, message: "省不能为空", trigger: "blur" }
        ],
        city: [
          { required: true, message: "市不能为空", trigger: "blur" }
        ],
        district: [
          { required: true, message: "区/县不能为空", trigger: "blur" }
        ],
        detailAddress: [
          { required: true, message: "详细地址不能为空", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "联系电话不能为空", trigger: "blur" }
        ],
        familyName1: [
          { required: true, message: "家属1姓名不能为空", trigger: "blur" }
        ],
        familyPhone1: [
          { required: true, message: "家属1电话不能为空", trigger: "blur" }
        ],
        graduateProvince: [
          { required: true, message: "毕业所在省不能为空", trigger: "blur" }
        ],
        graduateCity: [
          { required: true, message: "毕业所在市不能为空", trigger: "blur" }
        ],
        graduateDistrict: [
          { required: true, message: "毕业所在区/县不能为空", trigger: "blur" }
        ],
        graduateSchool: [
          { required: true, message: "毕业学校不能为空", trigger: "blur" }
        ],
        graduateStatus: [
          { required: true, message: "毕业情况不能为空", trigger: "change" }
        ],
        targetSchool: [
          { required: true, message: "报读学校不能为空", trigger: "blur" }
        ],
        majorDirection: [
          { required: true, message: "专业方向不能为空", trigger: "blur" }
        ],
        targetMajor: [
          { required: true, message: "报读专业不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询报名信息列表 */
    getList() {
      this.loading = true;
      listApplication(this.queryParams).then(response => {
        this.applicationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        name: null,
        idCardNumber: null,
        gender: null,
        birthDate: null,
        ethnicity: null,
        idCardAddress: null,
        idCardBackImage: null,
        idCardFrontImage: null,
        guardianIdCardFrontImage: null,
        guardianIdCardBackImage: null,
        householdCoverImage: null,
        householdInfoImage: null,
        householdOwnerCoverImage: null,
        householdOwnerInfoImage: null,
        graduationCertificateImage: null,
        province: null,
        city: null,
        district: null,
        detailAddress: null,
        phone: null,
        familyName1: null,
        familyPhone1: null,
        familyName2: null,
        familyPhone2: null,
        graduateProvince: null,
        graduateCity: null,
        graduateDistrict: null,
        graduateSchool: null,
        graduateStatus: null,
        examNumber: null,
        targetSchool: null,
        majorDirection: null,
        targetMajor: null,
        registrationStatus: null,
        status: null,
        remark: null,
        createdAt: null,
        updatedAt: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加报名信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getApplication(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改报名信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateApplication(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addApplication(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除报名信息编号为"' + ids + '"的数据项？').then(function() {
        return delApplication(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('application/application/export', {
        ...this.queryParams
      }, `application_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
